<template>
  <div>
    <!-- 导航 -->
    <!-- 头部选项卡 -->
    <van-tabs @click="jump">
      <van-tab v-for="item in list"  :key="item.id" :title="item.catename">
      </van-tab>
    </van-tabs>


  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      list: [],
    };
  },
  methods:{
    jump(e){
      // console.log(e);
      this.$router.push("/list?type=1&id=" + this.list[e].id);

    }
  },
  mounted() {
    axios({
      url: "/api/getcate",
      method: "get",
    }).then((res) => {
      // console.log(res);
      this.list = res.data.list;
    });
  },
};
</script>

<style scoped>
ul li {
  float: left;
  width: 1.4rem;
  height: 0.6rem;
  background-color: cornflowerblue;
}
ul li a {
  text-align: center;
  line-height: 0.5rem;
  color: white;
}
</style>